package com.yonyou.pmclouds.comprehensiveacceptance.process;

import com.yonyou.pmclouds.basecom.billstatus.BillStatusConst;
import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.comprehensiveacceptance.entity.ComprehensiveAcceptanceVO;
import com.yonyou.pmclouds.project.rmiitf.ProjectMaintain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AcceptanceApprovedWriteBackProjectProcessor implements SingleProcessor<ComprehensiveAcceptanceVO> {
    @Autowired
    private ProjectMaintain projectMaintain;

    @Override
    public void process(ComprehensiveAcceptanceVO vo, ComprehensiveAcceptanceVO orig) throws BusinessException {
        if (vo.getBillstatus() == BillStatusConst.COMMON_APPROVED_STATUS) {
            // 回写项目的验收日期
            projectMaintain.updateEndDateForAcceptance(vo.getPkProject(), vo.getAcceptanceTime());
        }
    }
}
